home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / HCAL-27 / METERS.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1997-01-28  |  7.4 KB  |  269 lines

  1. 10  'METERS - Meters (DC) : 15 DEC 85  rev. 29 SEP 96
  2. 20  IF EX$=""THEN EX$="exit"
  3. 30  PROG$="meters"
  4. 40  COMMON EX$,PROG$,R,E  'for chaining to PRECIRES
  5. 50  CLS:KEY OFF
  6. 60  COLOR 7,0,1
  7. 70  PI=3.14159
  8. 80  UL$=STRING$(80,205)       'underline
  9. 90  ER$=STRING$(80,32)        'erase
  10. 100  U$="####,###.###"
  11. 110  DIM A(50)                 'AWG sizes (American Wire Gauge)
  12. 120  '
  13. 130  '.....AWG wire sizes
  14. 140  K#= (0.46/0.005)^(1/39)        'incremental multiplier
  15. 150  FOR Z=1 TO 50
  16. 160  N=Z+3
  17. 170  WIRE=0.46/K#^N         'wire diameter in inches
  18. 180  A(Z)=WIRE             'wire diameter in inches
  19. 190  NEXT Z
  20. 200  '
  21. 210  COLOR 15,2
  22. 220  PRINT " METERS (Direct-Current)";TAB(57);"by George Murphy VE3ERP ";
  23. 230  COLOR 1,0:PRINT STRING$(80,223);
  24. 240  COLOR 7,0
  25. 250  T=7
  26. 260  PRINT TAB(T);
  27. 270  PRINT "This program calculates values of shunts and multipliers required"
  28. 280  PRINT TAB(T);
  29. 290  PRINT "to convert basic d'Arsonval meter movements into practical meters"
  30. 300  PRINT TAB(T);
  31. 310  PRINT "for measuring DC current or voltage."
  32. 320  PRINT UL$;
  33. 330  PRINT " Press number in < > to select instrument:"
  34. 340  PRINT UL$;
  35. 350  PRINT "  < 1 >  Ammeter"
  36. 360  PRINT "  < 2 >  Voltmeter"
  37. 370  PRINT UL$;
  38. 380  PRINT "    or press < 0 > to EXIT....."
  39. 390  Z$=INKEY$
  40. 400  IF Z$="0"THEN CLS:RUN EX$
  41. 410  IF Z$="1"THEN 450
  42. 420  IF Z$="2"THEN 1670
  43. 430  GOTO 390
  44. 440  '
  45. 450  '.....ammeter
  46. 460  LOCATE CSRLIN-1
  47. 470  PRINT " Press number in < > to choose standard units of measure:"
  48. 480  PRINT UL$;
  49. 490  PRINT "  < 3 >  Metric"
  50. 500  PRINT "  < 4 >  U.S.A./Imperial"
  51. 510  PRINT UL$;
  52. 520  Z$=INKEY$
  53. 530  IF Z$="3"THEN UM=25.4:UM$="mm.":GOTO 560
  54. 540  IF Z$="4"THEN UM=1:UM$="in.":GOTO 560
  55. 550  GOTO 520
  56. 560  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  57. 570  GOSUB 2150     'preface text
  58. 580  GOSUB 2560
  59. 590  GOTO 670
  60. 600  '
  61. 610  '.....display input
  62. 620  LOCATE CSRLIN-1:PRINT STRING$(7,32)
  63. 630  LOCATE CSRLIN-1,39:PRINT STRING$(40,32)
  64. 640  LOCATE CSRLIN-1,39:PRINT ".......";USING U$;Q;
  65. 650  RETURN
  66. 660  '
  67. 670  '.....ammeter
  68. 680  CLS
  69. 690  PRINT TAB(37);"AMMETER"
  70. 700  PRINT UL$;
  71. 710  PRINT
  72. 720  T=26:COLOR 0,7
  73. 730  LOCATE CSRLIN,T:PRINT "     shunt wire (coiled)      "
  74. 740  LOCATE CSRLIN,T:PRINT "         VARPTRSOUNDSOUND\/\/\SOUNDSOUNDCOLOR          "
  75. 750  LOCATE CSRLIN,T:PRINT "         CALL  VARPTRSOUNDSOUNDSOUNDCOLOR  CALL          "
  76. 760  LOCATE CSRLIN,T:PRINT " I(in) SOUNDSOUNDMOTORSOUNDSOUND<0xB4!> \ BLOADSOUNDSOUNDMOTORSOUNDSOUND I(out) "
  77. 770  LOCATE CSRLIN,T:PRINT "           +CLSSOUNDSOUNDSOUND'-            "
  78. 780  LOCATE CSRLIN,T:PRINT "            meter             "
  79. 790  COLOR 7,0
  80. 800  PRINT
  81. 810  INPUT " ENTER: Meter Movement (full scale).....(mA.)";Z:A=Z/1000
  82. 820  IF Z=0 THEN LOCATE CSRLIN-1:GOTO 810
  83. 830  Q=Z:GOSUB 610:PRINT " mA."
  84. 840  INPUT " ENTER: Internal Resistance............(ohms)";RM
  85. 850  IF RM=0 THEN LOCATE CSRLIN-1:GOTO 840
  86. 860  Q=RM:GOSUB 610:PRINT " ohms"
  87. 870  INPUT " ENTER: New Dial Full Scale............(amps)";B
  88. 880  IF B=0 THEN LOCATE CSRLIN-1:GOTO 870
  89. 890  Q=B:GOSUB 610:PRINT " amps"
  90. 900  C=B*250
  91. 910   FOR Z=40 TO 1 STEP -1
  92. 920    CM=(A(Z)*10^3)^2                                   'circular mils
  93. 930    IF CM>C THEN W=Z:GOTO 1000
  94. 940   NEXT Z
  95. 950  IF W<10 THEN BEEP:COLOR 0,7:PRINT:PRINT " NOT PRACTICAL ! "  'AWG<10
  96. 960  PRINT:COLOR 0,7:PRINT " Press any key to start over ":COLOR 7,0
  97. 970  Z$=INKEY$:IF Z$<>""THEN 680
  98. 980  GOTO 970
  99. 990  '
  100. 1000  PRINT TAB(9);"Shunt Wire minimum diameter..........";
  101. 1010  PRINT USING U$;A(Z)*UM;:PRINT " ";UM$;"  (#";W;"AWG)"
  102. 1020  LIN=CSRLIN
  103. 1030  PRINT UL$;
  104. 1040  PRINT " Press number in < > to choose how you want to select wire:"
  105. 1050  PRINT UL$;
  106. 1060  PRINT "   < 1 >  by Diameter"
  107. 1070  PRINT "   < 2 >  by AWG #"
  108. 1080  Z$=INKEY$
  109. 1090  IF Z$="1"THEN GOSUB 1130:GOTO 1160
  110. 1100  IF Z$="2"THEN GOSUB 1130:GOTO 1230
  111. 1110  GOTO 1080
  112. 1120  '
  113. 1130  VIEW PRINT LIN TO 24:CLS:VIEW PRINT:LOCATE LIN
  114. 1140  RETURN
  115. 1150  '
  116. 1160  '.....size by diameter
  117. 1170  PRINT " ENTER: Shunt Wire diameter.............(";UM$;")";:INPUT Q
  118. 1180  GOSUB 610:PRINT " ";UM$
  119. 1190  LOCATE CSRLIN-1,4:PRINT "USE:"
  120. 1200  DIA=Q/UM     'wire diameter in inches
  121. 1210  GOTO 1300
  122. 1220  '
  123. 1230  '.....size by AWG
  124. 1240  INPUT " ENTER: Selected Shunt Wire diameter.......(AWG#)";X
  125. 1250  Q=A(X)*UM:GOSUB 610:PRINT " ";UM$;"  (#";X;"AWG)"
  126. 1260  LOCATE CSRLIN-1,4:PRINT "USE:"
  127. 1270  DIA=A(X)     'wire diameter in inches
  128. 1280  GOTO 1300
  129. 1290  '
  130. 1300  IF DIA>=INT(A(Z)*10^3)/10^3 THEN 1350
  131. 1310  BEEP:COLOR 0,7
  132. 1320  PRINT:PRINT " CURRENT EXCEEDS WIRE CAPACITY !"
  133. 1330  COLOR 7,0:GOTO 960
  134. 1340  '
  135. 1350  IF UM=1 THEN M=UM:M$="in."ELSE M=2.54:M$="cm."
  136. 1360  PRINT " ENTER: Shunt Wire Coil diameter........(";M$;")";:INPUT D
  137. 1370  IF D=0 THEN LOCATE CSRLIN-1:GOTO 1350
  138. 1380  D=D/M
  139. 1390  LOCATE CSRLIN-1:PRINT ER$;:LOCATE CSRLIN-1
  140. 1400  CM=(DIA*10^3)^2 'circular mils
  141. 1410  OMFT=10371/CM   'ohms per 1000 feet
  142. 1420  R=OMFT/12000    'ohms per inch
  143. 1430  N=B/A           'factor by which original meter scale is to be multiplied
  144. 1440  S=RM/(N-1)      'shunt resistance
  145. 1450  L=S/R           'shunt length
  146. 1460  PRINT TAB(9);"Shunt resistance.....................";USING U$;S;
  147. 1470  PRINT " ohms"
  148. 1480  PRINT TAB(9);"Shunt Wire capacity..................";USING U$;CM/250;
  149. 1490  PRINT " amps"
  150. 1500  IF UM=1 THEN M=UM:M$=UM$ ELSE M=2.54:M$="cm."
  151. 1510  PRINT TAB(9);"Shunt Wire length....................";USING U$;L*M;
  152. 1520  PRINT " ";M$
  153. 1530  PRINT TAB(9);"Shunt Coil diameter..................";USING U$;D*M;
  154. 1540  PRINT " ";M$
  155. 1550  PRINT TAB(9);"Shunt Coil length....................";USING U$;L/D/PI;
  156. 1560  PRINT " turns"
  157. 1570  PRINT UL$;
  158. 1580  T=7
  159. 1590  PRINT TAB(T);
  160. 1600  PRINT " Resistance wire may be wound in a coil as suggested, or it may be"
  161. 1610  PRINT TAB(T);
  162. 1620  PRINT " wound in a loop around the inside walls of the chassis, or even"
  163. 1630  PRINT TAB(T);
  164. 1640  PRINT " bundled or bunched in any random fashion.";
  165. 1650  GOTO 2510      'end
  166. 1660  '
  167. 1670  '....voltmeter
  168. 1680  CLS
  169. 1690  PRINT TAB(36);"VOLTMETER"
  170. 1700  PRINT UL$;
  171. 1710  PRINT
  172. 1720  T=27:COLOR 0,7
  173. 1730  LOCATE CSRLIN,T:PRINT " + SOUNDSOUNDSOUNDBSAVESOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUND "
  174. 1740  LOCATE CSRLIN,T:PRINT "      CALL multiplier       "
  175. 1750  LOCATE CSRLIN,T:PRINT "      CLSSOUNDSOUNDSOUND\/\/\/SOUNDSOUNDCOLOR      "
  176. 1760  LOCATE CSRLIN,T:PRINT "                VARPTRSOUNDMOTORSOUNDCOLOR+   "
  177. 1770  LOCATE CSRLIN,T:PRINT "           meterCALL \ CALL    "
  178. 1780  LOCATE CSRLIN,T:PRINT "                CLSSOUNDBSAVESOUND'-   "
  179. 1790  LOCATE CSRLIN,T:PRINT " - SOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDMOTORSOUNDSOUNDSOUNDSOUNDSOUND "
  180. 1800  COLOR 7,0
  181. 1810  PRINT
  182. 1820  INPUT " ENTER: Meter Movement - Full Scale.....(mA.)";Z:I=Z/1000
  183. 1830  Q=Z:GOSUB 610:PRINT " mA."
  184. 1840  RM=0        'internal resistance
  185. 1850  PRINT " Is the internal resistance of the meter known?   (y/n)"
  186. 1860  Z$=INKEY$
  187. 1870  IF Z$="Y"OR Z$="y"THEN LOCATE CSRLIN-1:PRINT ER$:LOCATE CSRLIN-2:GOTO 1900
  188. 1880  IF Z$="N"OR Z$="n"THEN LOCATE CSRLIN-1:PRINT ER$:LOCATE CSRLIN-2:GOTO 1920
  189. 1890  GOTO 1860
  190. 1900  INPUT " ENTER: Internal Resistance............(ohms)";RM
  191. 1910  Q=RM:GOSUB 610:PRINT " ohms":GOTO 1960
  192. 1920  PRINT "        Internal Resistance.................."
  193. 1930  RM=100
  194. 1940  Q=RM:GOSUB 610:PRINT " ohms (assumed)"
  195. 1950  '
  196. 1960  INPUT " ENTER: Desired Full Scale Reading....(volts)";E
  197. 1970  Q=E:GOSUB 610:PRINT " volts"
  198. 1980  '
  199. 1990  R=E/I-RM
  200. 2000  PRINT "        Multiplier Resistor.................."
  201. 2010  Q=R:GOSUB 610:PRINT " ohms"
  202. 2020  '
  203. 2030  VR=RM+R
  204. 2040  PRINT "        Total Voltmeter Resistance..........."
  205. 2050  Q=VR:GOSUB 610:PRINT " ohms"
  206. 2060  '
  207. 2070  S=(R+RM)/E
  208. 2080  PRINT "        Voltmeter Sensitivity................"
  209. 2090  Q=S:GOSUB 610:PRINT " ohms per volt"
  210. 2100  '
  211. 2110  GOSUB 2560     'screen dump
  212. 2120  CLS:CHAIN"precires"
  213. 2130  END
  214. 2140  '
  215. 2150  '.....meter shunt preface
  216. 2160  TB=8     'tab for text
  217. 2170  PRINT TAB(TB);
  218. 2180  PRINT "It is necessary to know the meter's internal resistance before"
  219. 2190  PRINT TAB(TB);
  220. 2200  PRINT "the required value for a shunt can be calculated. The internal"
  221. 2210  PRINT TAB(TB);
  222. 2220  PRINT "resistance may vary from a fraction of an ohm to a few thousand"
  223. 2230  PRINT TAB(TB);
  224. 2240  PRINT "ohms, with the higher resistance values associated with higher"
  225. 2250  PRINT TAB(TB);
  226. 2260  PRINT "sensitivity."
  227. 2270  PRINT
  228. 2280  PRINT TAB(TB);
  229. 2290  PRINT "Often the resistance of a particular meter will be unknown. This"
  230. 2300  PRINT TAB(TB);
  231. 2310  PRINT "is usually the case when a meter is purchased at a flea market or"
  232. 2320  PRINT TAB(TB);
  233. 2330  PRINT "is obtained from a commercial piece of equipment. Unfortunately"
  234. 2340  PRINT TAB(TB);
  235. 2350  PRINT "the internal resistance of a meter CANNOT be measured directly"
  236. 2360  PRINT TAB(TB);
  237. 2370  PRINT "with a VOM or VTVM without risk of damage to the meter movement."
  238. 2380  PRINT TAB(TB);
  239. 2390  PRINT
  240. 2400  PRINT TAB(TB);
  241. 2410  PRINT "However, most modern digital multimeters CAN be used to measure"
  242. 2420  PRINT TAB(TB);
  243. 2430  PRINT "the internal resistance of a meter directly."
  244. 2440  PRINT
  245. 2450  PRINT TAB(TB);
  246. 2460  PRINT "Refer to the ARRL Handbook for methods of measuring the internal"
  247. 2470  PRINT TAB(TB);
  248. 2480  PRINT "resistance of a meter using a VOM or VTVM."
  249. 2490  RETURN
  250. 2500  '
  251. 2510  '.....end
  252. 2520  GOSUB 2560
  253. 2530  CLS:GOTO 210
  254. 2540  END
  255. 2550  '
  256. 2560  'HARDCOPY
  257. 2570  GOSUB 2680:LOCATE 25,2:COLOR 14,6
  258. 2580  PRINT " Press 1 to print screen, 2 to print screen & ";
  259. 2590  PRINT "advance paper, or 3 to continue.";:COLOR 7,0
  260. 2600  Z$=INKEY$:IF Z$="3"THEN GOSUB 2680:RETURN
  261. 2610  IF Z$="1"OR Z$="2"THEN GOSUB 2680:GOTO 2630
  262. 2620  GOTO 2600
  263. 2630  FOR QX=1 TO 24:FOR QY=1 TO 80
  264. 2640  LPRINT CHR$(SCREEN(QX,QY));
  265. 2650  NEXT QY:NEXT QX
  266. 2660  IF Z$="2"THEN LPRINT CHR$(12)
  267. 2670  GOTO 2570
  268. 2680  LOCATE 25,1:PRINT STRING$(80,32);:RETURN
  269.